#ifndef FILEHANDLER2_H
#define FILEHANDLER2_H

#include <QObject>
#include <QMap>
#include <fstream>
#include <QProcess>
#include "jsoncons/json.hpp"


class FileHandler2 : public QObject
{
    Q_OBJECT
public:
    explicit FileHandler2(const QString& file, QObject *parent = nullptr);
    void loadFile();
    QMap<QString, QString> loadJson();
    bool saveFile(const QMap<QString, QString>& map);

signals:
    void json_generated(bool);
    void save_done(bool);

private:
    QString m_cachefile;
    QString m_jsonfile;
    std::ifstream m_ifs;
    std::ofstream m_ofs;
    QProcess* m_process;
    QString m_nameid;
    jsoncons::ojson m_json;

};

#endif // FILEHANDLER2_H
